import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router'
import Login from '@/views/common/Login.vue'
import InspectorMain from '@/views/inspector/InspectorMain.vue'
import InspectorHome from '@/views/inspector/home.vue'
import SemiFinishedInspectionEntry from '@/views/inspector/SemiFinishedInspectionEntry.vue'
import RawMaterialInspectionEntry from '@/views/inspector/RawMaterialInspectionEntry.vue'
import FinishedInspectionEntry from '@/views/inspector/FinishedInspectionEntry.vue'
import Profile from '@/views/common/Profile.vue'
import ResetPassword from '@/views/common/ResetPassword.vue'
import ChangeAvatar from '@/views/common/ChangeAvatar.vue'
import AgingTestHome from '@/views/inspector/AgingTestHome.vue'
import AgingTestTrend from '@/views/inspector/AgingTestTrend.vue'
import AgingTestAdd from '@/views/inspector/AgingTestAdd.vue'

// 供应链主管相关组件
import SupervisorMain from '@/views/supplyChainSupervisor/SupervisorMain.vue'
import SupervisorHome from '@/views/supplyChainSupervisor/home.vue'
import SupervisorOrder from '@/views/supplyChainSupervisor/order.vue'
import SupplierQuality from '@/views/supplyChainSupervisor/supplier-quality.vue'

// 系统管理员相关组件
import AdminMain from '@/views/admin/AdminMain.vue'
import AdminHome from '@/views/admin/home.vue'
import QualityDataManagement from '@/views/admin/QualityDataManagement.vue'
import UserManagement from '@/views/admin/UserManagement.vue'
import PermissionManagement from '@/views/admin/PermissionManagement.vue'

// 质量经理相关组件
import QualityManagerHome from '@/views/qualityManager/QualityManagerHome.vue'
import QualityDashboard from '@/views/qualityManager/QualityDashboard.vue'
import QualityAudit from '@/views/qualityManager/QualityAudit.vue'
import ExceptionTracking from '@/views/qualityManager/ExceptionTracking.vue'

// 工艺工程师相关组件
import ProcessEngineerMain from '@/views/processEngineer/ProcessEngineerMain.vue'
import ProcessEngineerHome from '@/views/processEngineer/ProcessEngineerHome.vue'
import RawMaterialStandardEntry from '@/views/processEngineer/RawMaterialStandardEntry.vue'
import SemiFinishedStandardEntry from '@/views/processEngineer/SemiFinishedStandardEntry.vue'
import FinishedProductStandardEntry from '@/views/processEngineer/FinishedProductStandardEntry.vue'


//配置路由
const routes: Array<RouteRecordRaw> = [
    {
        path: '/',
        redirect: '/login'
    },
    {
        path: '/login',
        name: 'Login',
        component: Login
    },
    {
        path: '/inspector',
        component: InspectorMain,
        redirect: '/inspector/home',
        children: [
            { path: '/inspector/home',component: InspectorHome },
            { path: '/inspector/semi-finished-standard', component: SemiFinishedInspectionEntry },
            { path: '/inspector/raw-material-standard', component: RawMaterialInspectionEntry },
            { path: '/inspector/finished-standard', component: FinishedInspectionEntry },
            { path: '/inspector/aging-test-home', component: AgingTestHome },
            { path: '/inspector/aging-test-trend', component: AgingTestTrend },
            { path: '/inspector/aging-test-add', component: AgingTestAdd },
            { path: '/inspector/profile', component: Profile},
            { path: '/inspector/reset-password', component: ResetPassword},
            { path: '/inspector/change-avatar', component: ChangeAvatar}
        ]
    },
    {
        path: '/supervisor',
        component: SupervisorMain,
        redirect: '/supervisor/home',
        children: [
            { path: '/supervisor/home', component: SupervisorHome },
            { path: '/supervisor/order', component: SupervisorOrder },
            { path: '/supervisor/supplier-quality', component: SupplierQuality },
            { path: '/supervisor/profile', component: Profile },
            { path: '/supervisor/reset-password', component: ResetPassword },
            { path: '/supervisor/change-avatar', component: ChangeAvatar }
        ]
    },
    {
        path: '/admin',
        component: AdminMain,
        redirect: '/admin/home',
        children: [
            { path: '/admin/home', component: AdminHome },
            { path: '/admin/quality-data', component: QualityDataManagement },
            { path: '/admin/user-management', component: UserManagement },
            { path: '/admin/permission-management', component: PermissionManagement },
            { path: '/admin/profile', component: Profile },
            { path: '/admin/reset-password', component: ResetPassword },
            { path: '/admin/change-avatar', component: ChangeAvatar }
        ]
    },
    {
        path: '/quality-manager',
        component: QualityManagerHome,
        redirect: '/quality-manager/dashboard',
        children: [
            { path: '/quality-manager/dashboard', component: QualityDashboard },
            { path: '/quality-manager/audit', component: QualityAudit },
            { path: '/quality-manager/exception-tracking', component: ExceptionTracking },
            { path: '/quality-manager/profile', component: Profile },
            { path: '/quality-manager/reset-password', component: ResetPassword },
            { path: '/quality-manager/change-avatar', component: ChangeAvatar }
        ]
    },
    {
        path: '/process-engineer',
        component: ProcessEngineerMain,
        redirect: '/process-engineer/home',
        children: [
            { path: '/process-engineer/home', component: ProcessEngineerHome },
            { path: '/process-engineer/raw-material-standard', component: RawMaterialStandardEntry },
            { path: '/process-engineer/semi-finished-standard', component: SemiFinishedStandardEntry },
            { path: '/process-engineer/finished-product-standard', component: FinishedProductStandardEntry },
            { path: '/process-engineer/profile', component: Profile },
            { path: '/process-engineer/reset-password', component: ResetPassword },
            { path: '/process-engineer/change-avatar', component: ChangeAvatar }
        ]
    },
]

//创建路由器
const router = createRouter({
    history: createWebHistory(),
    routes: routes
})

//导出路由器
export default router;